KEYS: Make use of platform keyring for module signature verify
authorRobert Holmes <robeholmes@gmail.com>
Tue, 23 Apr 2019 07:39:29 +0000 (07:39 +0000)
committerSalvatore Bonaccorso <carnil@debian.org>
Sat, 7 Dec 2019 12:24:06 +0000 (12:24 +0000)
This patch completes commit 278311e417be ("kexec, KEYS: Make use of
platform keyring for signature verify") which, while adding the
platform keyring for bzImage verification, neglected to also add
this keyring for module verification.

As such, kernel modules signed with keys from the MokList variable
were not successfully verified.

Signed-off-by: Robert Holmes <robeholmes@gmail.com>
Signed-off-by: Jeremy Cline <jcline@redhat.com>
Gbp-Pq: Topic features/all/db-mok-keyring
Gbp-Pq: Name KEYS-Make-use-of-platform-keyring-for-module-signature.patch

kernel/module_signing.c

index 3afff3718d72900f3faa4736b371f43754b15149..7c51c0559e50cf74448e854c1425242b39b5840a 100644 (file)
@@ -135,6 +135,13 @@ int mod_verify_sig(const void *mod, struct load_info *info)
                                      VERIFYING_MODULE_SIGNATURE,
                                      NULL, NULL);
        pr_devel("verify_pkcs7_signature() = %d\n", ret);
+       if (ret == -ENOKEY && IS_ENABLED(CONFIG_INTEGRITY_PLATFORM_KEYRING)) {
+               ret = verify_pkcs7_signature(mod, modlen, mod + modlen, sig_len,
+                               VERIFY_USE_PLATFORM_KEYRING,
+                               VERIFYING_MODULE_SIGNATURE,
+                               NULL, NULL);
+                pr_devel("verify_pkcs7_signature() = %d\n", ret);
+       }
 
        /* checking hash of module is in blacklist */
        if (!ret)